<?php
require("../class/connect.php");
require("../class/db_sql.php");
require("../data/dbcache/class.php");
require("../class/user.php");
require("../class/q_functions.php");
require("../class/page_obj.php");
require LoadLang("pub/fun.php");
$link=db_connect();
$empire=new mysqlquery();
//验证是否登陆
$user=islogin();
//取得模型id
$l=$_GET['l'];
$mid=$_GET['mid'];
$mode_id=$_GET['m'];
$editConfigArr=array(10=>array(
							"enews"=>"MAddInfo",
							"classid"=>65,
							"mid"=>10,
							"js"=>"",
							"css"=>"",
							"my_link"=>array('<a class="tips active"  href="#">添加活动</a>','<a class="tips "  href="../ed/?e=10000">我创建的活动</a>'),
							"ta_link"=>array("TA创建的活动"),
							"skin"=>"n_list",
							));
$editConfigArr=array(11=>array(
							"enews"=>"MAddInfo",
							"classid"=>65,
							"mid"=>10,
							"js"=>"",
							"css"=>"",
							"my_link"=>array('<a class="tips active"  href="#">添加活动</a>','<a class="tips "  href="../ed/?e=10000">我创建的活动</a>'),
							"ta_link"=>array("TA创建的活动"),
							"skin"=>"e_tribe",
							));

$mode=array(
				'j'=>array(
							'sql'=>'SELECT T.*,C.time as jionTime  FROM 
												phome_ecms_tribe T 
											LEFT JOIN
												phome_jat_jointribe C ON C.tid=T.id
											WHERE C.uid="'.$user[userid].'"',							
							'skin'=>'join_tribe',
							'numsql'=>'SELECT COUNT(T.id) as total FROM 
												phome_ecms_tribe T 
											LEFT JOIN
												phome_jat_jointribe C ON C.tid=T.id
											WHERE C.uid="'.$user[userid].'"',
							'my_link'=>'',
							),
				'fs'=>array(
							'sql'=>'SELECT T.*,FS.time as jionTime  FROM 
												phome_ecms_tribe T 
											LEFT JOIN
												phome_jat_focus FS ON (FS.t_uid=T.userid AND FS.type_id="'.USR_FOCUS_ID.'")
											WHERE FS.uid="'.$user[userid].'"',
							'numsql'=>'SELECT COUNT(T.id) as total FROM 
												phome_ecms_tribe T 
											LEFT JOIN
												phome_jat_focus FS ON (FS.t_uid=T.userid AND FS.type_id="'.USR_FOCUS_ID.'")
											WHERE FS.uid="'.$user[userid].'"',
							'skin'=>'focus_tribe',
							'my_link'=>'',
							'js'=>$public_r['newsurl'].'skin/default/js/tribe_func.js',
					)
				//''=>
			);

$configApp=$editConfigArr[$mid];
if($mode_id && is_array($mode[$mode_id])){
	$configApp=array_merge($configApp,$mode[$mode_id]);
}
if(!is_array($configApp)){ echo "error!"; exit();}
if(!$mid)
{
	printerror("ErrorUrl","history.go(-1)",1);
}

$mr=$empire->fetch1("select tbname,qmname,listfile from {$dbtbpre}enewsmod where mid='$mid'");
//print_r($mr);
if(!$mr['tbname'])
{
	printerror("ErrorUrl","history.go(-1)",1);
}
esetcookie("qdelinfo","dgcms");
//-----------------------------------------add by jat--------------------------------------------------
$pNum=$_GET['p'];
if(empty($configApp['numsql'])){
	$nums=DbTouch($dbtbpre.'ecms_'.$mr['tbname'],array('userid'=>$user[userid]),'count(*) as total');
}else{
	$nums=$empire->fetch1($configApp['numsql']);
}
$page=new page_obj($pNum,array("itemnum"=>10,"border"=>4,"row_count"=>$nums['total']));
$limit_str=$page->get_limit_str();
$returnpage=$page->build_html_link("p");
//-----------------------------------------add by jat---------------------------------------------------

$deftempfile=ECMS_PATH.'e/data/html/list/qlistinfo.php';

if($configApp['skin']){
	$tempfile=ECMS_PATH.'e/data/html/list/jat_'.$configApp['skin'].'.php';
}else{
	if($mr[listfile]){		
		$tempfile=ECMS_PATH.'e/data/html/list/q'.$mr[listfile].'.php';		
		if(!file_exists($tempfile)){
			$tempfile=$deftempfile;
		}
	}else{
		$tempfile=$deftempfile;
	}
}
if($configApp['js']){
	$page_load_js=$configApp['js'];
}
require($tempfile);
db_close();
$empire=null;
?>